﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using HF.WCF.WFService;


namespace HF.WCF.DBServer
{
    class Program
    {
        static List<ServiceHost> _Host=new List<ServiceHost>();
        static void Main(string[] args)
        {
             InitialService();
            Console.WriteLine("HF WorkFlowServer Start Up...");
            Console.Read();
            CloseService();
        }
        static void InitialService()
        {
            RegisterService(typeof(WorkFlowService));
            RegisterService(typeof(ArchitectureService));
            RegisterService(typeof(UserService));
            
        }

        static void RegisterService(Type serviceType)
        {
            ServiceHost host = new ServiceHost(serviceType);
            host.Open();
            _Host.Add(host);
        }

        static void CloseService() 
        {
            foreach(ServiceHost host in _Host)
            {
                host.Close();
            }

            _Host.Clear();
        }
    }
}
